Skip to content

refactor(provisioning): readability + maintainability sweep#71

Merged
jmgilman merged 4 commits into
masterfrom
session-040/provisioning-sweep
May 28, 2026
Merged

refactor(provisioning): readability + maintainability sweep#71
jmgilman merged 4 commits into
masterfrom
session-040/provisioning-sweep

Conversation

@jmgilman
Copy link
Copy Markdown
Contributor

Summary

Test plan

  • moon run root:check --summary minimal green per commit (format, lint, build, unit, Testcontainers integration)
  • testkit/internal/authflow integration suite covers the renamed RuleLister field via the full auth flow
  • Cache white-box test TestCompileConditionCachesNormalizedProgram still passes after the condition.go split (cache type stayed in condition.go)

🤖 Generated with Claude Code

jmgilman and others added 4 commits May 27, 2026 20:55
…rt assertion

Extract CEL environment construction and ref.Val helpers into cel.go; condition.go
keeps the condition lifecycle (compile/cache/match/validate). Rename
ResolverOptions.RuleSource to RuleLister to match the authkit.ProvisioningRuleLister
port name. Add the missing compile-time PrincipalResolver assertion on *Resolver.
Expand the package doc to spell out the wrap-and-conditional-provision contract.

Cascade: testkit/internal/authflow/runtime.go updates the struct-literal field name.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Godoc every private function and module-scope global, replacing the bare nolint
justifications on conditionEnvironment and conditionProgramCache with real docs.
Annotate the four CEL fail-closed gates (eval error, non-bool runtime output, AST
output-type check, CostLimit/InterruptCheckFrequency bounding) and the two
provisioning gates in ResolveIdentity (ErrUnresolvedIdentity-only triggers
provisioning, factory denial preserves the original unresolved error).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Move test fixtures and hand-rolled fakes into helpers_test.go; move
TestMatchRules and TestValidateConditionRejectsInvalidExpressions into
rules_test.go; resolver_test.go keeps the constructor and ResolveIdentity
cases. Mechanical lift — no behaviour change.

Drop TestResolverSatisfiesPrincipalResolver: the production-side
var _ authkit.PrincipalResolver = (*Resolver)(nil) assertion added earlier
in this PR subsumes it, matching the PR #62/#68 drop precedent.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replace fakeResolver, fakeProvisioner, and fakeRuleSource with the
authkitmocks.{PrincipalResolver,IdentityProvisioner,ProvisioningRuleLister}
constructors that mockery already generates. Each test configures the
specific expectation it needs and passes unconfigured mocks for ports its
short-circuit path never reaches so stray calls panic rather than silently pass.

No .mockery.yaml change; all three entries existed before this PR.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jmgilman jmgilman merged commit d441ced into master May 28, 2026
2 checks passed
@jmgilman jmgilman deleted the session-040/provisioning-sweep branch May 28, 2026 05:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant